package cn.yunlang.zhangZhongFei.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import lombok.Data;

/**
 * 公司评论表
 *
 * @author ·
 * @since 2025-05-26 14:50:46
 */
@Data
@TableName("t_comment")
@ApiModel(value = "Comment对象", description = "公司评论表")
public class Comment implements Serializable {

  private static final long serialVersionUID = 1L;

  @ApiModelProperty(value = "id", hidden = true)
  @TableId(value = "id", type = IdType.AUTO)
  private Long id;

  @ApiModelProperty("用户id")
  @TableField("user_id")
  @JsonIgnore
  private Long userId;

  @ApiModelProperty("公司id")
  @TableField("company_id")
  private Long companyId;

  @ApiModelProperty("顶级评论id")
  @TableField("top_id")
  private Long topId;

  @ApiModelProperty("上级评论id")
  @TableField("parent_id")
  private Long parentId;

  @ApiModelProperty("评论正文")
  @TableField("text")
  private String text;

  @ApiModelProperty("是否删除(0=否，1=是)")
  @TableField("is_delete")
  @TableLogic
  private String isDelete;

  @ApiModelProperty("创建时间")
  @TableField(value = "create_time", fill = FieldFill.INSERT)
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
  private Date createTime;

  @ApiModelProperty("修改时间")
  @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
  private Date updateTime;

  /*=======================================*/

  @ApiModelProperty("子评论（目前默认5条）")
  @TableField(exist = false)
  private List<Comment> childs;

  @ApiModelProperty("评论用户名")
  @TableField(exist = false)
  private String username;

  @ApiModelProperty("评论用户头像")
  @TableField(exist = false)
  private String userAvatar;
}
